meson: Clean up FreeType2 dependency search
authorChun-wei Fan <fanchunwei@src.gnome.org>
Fri, 9 Dec 2022 04:41:10 +0000 (12:41 +0800)
committerChun-wei Fan <fanchunwei@src.gnome.org>
Fri, 9 Dec 2022 04:41:10 +0000 (12:41 +0800)
Since we are using Meson 0.60.x now, make use of CMake's support for finding
FreeType in addition to pkg-config, which actually looks for FreeType2 via
looking at the headers and .lib's internally, so we don't have to reinvent
the wheel.

Sadly, we don't have similar support for Cairo and HarfBuzz in CMake, so we
have to stick with what we have now, since we still need to support older
HarfBuzz and Cairo versions as we are in a stable release series.

meson.build

index 3d11eb1fa0e0b95e99d84c4e22293578b381e347..8726822897591771e3ec4ddda70e5c99e51df5b3 100644 (file)
@@ -416,25 +416,9 @@ if pangoft_dep.found()
   # We get the dependency itself from pango, but pango doesn't care
   # about ft2 version, so an extra check is needed.
 
-  # Update once Meson can have deps declared in a declarative manner
-  ft2_dep      = dependency('freetype2', version: '>= 2.7.1', required: false)
-
-  if not ft2_dep.found() and cc.get_id() == 'msvc'
-    if cc.has_header('ft2build.h') and cc.has_header('freetype/ftmm.h')
-      ft_lib = cc.find_library('freetype', required: false)
-      if ft_lib.found()
-        if cc.has_function('FT_Get_Var_Design_Coordinates', dependencies: ft_lib,
-                           prefix: '''#include <ft2build.h>
-                                      #include FT_MULTIPLE_MASTERS_H''')
-          ft2_dep = ft_lib
-        endif
-      endif
-    endif
-  endif
-
-  if not ft2_dep.found()
-    ft2_dep      = dependency('freetype2', version: '>= 2.7.1', fallback : ['freetype2', 'freetype_dep'])
-  endif
+  ft2_dep      = dependency(['freetype2','FreeType'],
+                            version: '>= 2.7.1',
+                            fallback : ['freetype2', 'freetype_dep'])
 endif
 
 if win32_enabled